<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>查看订单修改记录</title>
    </head>
    <body>
        <div id="query_form">
        </div>
        <div id="checkUpdateGrid" class="x-form-item">
        </div>
        <script>
            var orderds; //数据源
            Ext.onReady(function(){
                var fromDate = new Ext.form.DateField({
                    fieldLabel: '统计日期从',
                    name: 'from_date',
                    id: 'from_date',
                    //altFormats: 'Y-m-d',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: false,
					blankText: '开始日期必须选择',
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //applyTo: 'from_date',
                    //anchor: '80%',
                    vtype: 'daterange',
                    endDateField: 'to_date',
                    width: 90
                    //,value: today
                });
                
                var toDate = new Ext.form.DateField({
                    fieldLabel: '到',
                    name: 'to_date',
                    id: 'to_date',
                    //altFormats: 'Y-m-d',
                    format: 'Y-m-d', //格式化日期
                    //disabledDays: [0,6],	//不让选择周六，周日
                    //disabledDaysText: "周末要休息",
                    invalidText: "您输入的日期格式不对，正确格式为2008-01-01",
                    allowBlank: false,
					blankText: '截止日期必须选择',
                    //emptyText: '请选择...',
                    inputType: '2008-01-01',
                    //applyTo: 'to_date',
                    //anchor: '80%',
                    vtype: 'daterange',
                    startDateField: 'from_date',
                    width: 90
                    //,value: today
                });
                
                var queryButton = new Ext.Button({
                    text: '查 询',
                    handler: function(){
						if (formPanel.form.isValid()) {
							orderds.baseParams.from_date = fromDate.getValue().format('Y-m-d');
							orderds.baseParams.to_date = toDate.getValue().format('Y-m-d');
							orderds.reload();
						}
                    }
                })
                
                var formPanel = new Ext.form.FormPanel({
                    //baseCls: 'x-plain',
                    labelWidth: 75,
                    width: '100%',
					frame: true,
                    labelAlign: 'right',
                    items: [{
                        layout: 'column',
                        border: false,
                        items: [{
                            columnWidth: .2,
                            layout: 'form',
                            border: false,
                            items: [fromDate]
                        }, {
                            columnWidth: .2,
                            layout: 'form',
                            border: false,
                            items: [toDate]
                        }, {
                            columnWidth: .4,
                            layout: 'form',
                            border: false,
                            items: [queryButton]
                        }]
                    }]
                });

                formPanel.render('query_form');

                //############## 订单Grid ##############
                var ordercm = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), {
                    header: '编号',
                    dataIndex: 'id',
                    hidden: true
                }, {
                    header: '订单编号',
                    dataIndex: 'order_no',
                    width: 100
                }, {
                    header: 'PNR',
                    dataIndex: 'pnr',
                    width: 50
                }, {
                    header: '客户名称',
                    dataIndex: 'customer',
                    width: 70
                }, {
                    header: '订单状态',
                    dataIndex: 'status',
                    width: 70
                }, {
                    header: '总金额',
                    dataIndex: 'price_sum',
                    width: 70
                }, {
                    header: '乘机日期',
                    dataIndex: 'fly_date',
                    width: 70
                }, {
                    header: '起飞时间',
                    dataIndex: 'fly_time',
                    width: 70
                }, {
                    header: '送票地址',
                    dataIndex: 'send_address',
                    width: 200
                }, {
                    header: '联系人',
                    dataIndex: 'link_man',
                    width: 70
                }, {
                    header: '联系电话',
                    dataIndex: 'link_tel',
                    width: 100
                }, {
                    header: '预定人',
                    dataIndex: 'creator',
                    width: 70
                }, {
                    header: '预定时间',
                    dataIndex: 'created_at',
                    width: 120,
                    renderer: Ext.util.Format.dateRenderer('Y-m-d H:i')
                }, {
                    header: '出票人',
                    dataIndex: 'ticket_outer',
                    width: 70
                }, {
                    header: '出票时间',
                    dataIndex: 'ticket_out_date',
                    width: 120,
                    renderer: Ext.util.Format.dateRenderer('Y-m-d H:i')
                }, {
                    header: '送票人',
                    dataIndex: 'sender',
                    width: 70
                }, {
                    header: '送票时间',
                    dataIndex: 'send_date',
                    width: 100
                }, {
                    header: '收款人',
                    dataIndex: 'cash_checker',
                    width: 70
                }, {
                    header: '收款时间',
                    dataIndex: 'cash_get_date',
                    width: 120,
                    renderer: Ext.util.Format.dateRenderer('Y-m-d H:i')
                }, {
                    header: '客户要求',
                    dataIndex: 'order_request',
                    width: 120
                }, {
                    header: '修改时间',
                    dataIndex: 'updated_at',
                    width: 120,
                    renderer: Ext.util.Format.dateRenderer('Y-m-d H:i')
                }]);
                
                //隐藏order数据库id
                //ordercm.setHidden(1, !ordercm.isHidden(1));
                orderds = new Ext.data.Store({
                    proxy: new Ext.data.HttpProxy({
                        url: '/orders/getOrderUpdateHis'
                    }),
                    reader: orderReader
                });
                
                var ordergridpanel = new Ext.grid.GridPanel({
                    el: 'checkUpdateGrid',
                    ds: orderds,
                    cm: ordercm,
                    //sm: sm,
                    loadMask: true,
                    autoWidth: true,
                    collapsible: true,
                    animCollapse: true,
                    height: 480,
                    title: '订单修改记录',
                    bbar: new Ext.PagingToolbar({
                        pageSize: 15,
                        displayInfo: true,
                        displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
                        emptyMsg: "没有记录",
                        store: orderds
                    })
                });
                
                ordergridpanel.render();
                orderds.load({
                    params: {
                        start: 0,
                        limit: 15
                    }
                });
                
            })
        </script>
    </body>
</html>
